int my_strcmp(const char *s1, const char *s2){
	int i = 0;
	while(s1[i] == s2[i] && s1[i]){
		i++;
	}
	return s1[i] - s2[i];	

}


char *my_strchr(const char *s, int c){
	int i = 0;
	while(s[i]){
		if(s[i] == c){
			break;
		}
		i++;
	}
	if(s[i]){
		return s+i;
	}else{
		return NULL;
	}
}

size_t my_strlen(const char *s){
	int i = 0;
	while(s[i]){
		i++;
	}
	return i;
}
char *my_strncat(char *dest, const char *src, size_t n){
	size_t m = strlen(dest);
	size_t i = 0;
	while(i < n && src[i]){
		dest[m + i] = src[i];
		i++;
	}
	dest[m + i] = '\0';
	return dest;
}
char *my_strncpy(char *dest, const char *src, size_t n){
	size_t i = 0;
	while(i < n && src[i]){
		dest[i]  = src[i];
		i++;
	}
	while(i < n){
		dest[i] = '\0';
		i++;
	}
	return dest;
}
char *my_strstr(const char *haystack, const char *needle){
	size_t i = 0;
	size_t j = 0;
	size_t t;
	while(haystack[i]){
		t = i;
		j = 0;
		while(needle[j]){
			if(haystack[t] == needle[j]){
				t++;
				j++;
				if(needle[j] == '\0'){
					return haystack + i;
				}
			}else{
				break;
			}
		}
		i++;
	}
	return NULL;		
}
